﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OnlineStore.Data_Access_Layer;

namespace OnlineStore
{
    public class BisTrans
    {
        // save to transaction
        protected int SaveTransaction(string strTranDate, string strProductID, int nQty, string DocRef)
        {
            try
            {
                OnlineStoreEntities eOnlineStoreEntities = new OnlineStoreEntities();
                tbTransaction eTransaction = new tbTransaction();
                eTransaction.Doc_Ref = int.Parse(DocRef);
                eTransaction.Product_ID = int.Parse(strProductID.ToString());
                eTransaction.Qty = nQty;
                eTransaction.Tran_Date = DateTime.Parse(strTranDate);
                eOnlineStoreEntities.AddTotbTransactions(eTransaction);
                eOnlineStoreEntities.SaveChanges();
            }
            catch (Exception ex)
            {
                ex.ToString();
                return -1;
            }
            return 1;
        }
    }
}
